package com.erweek.homework1;

/**
 * 1~100能被7整除的数之和[1,100]
 */
public class HomeWork1 {
    public static void main(String[] args) {
        //定义一个sum接收1~100能被7整除的数之和
        int sum = 0;
        for (int i = 1; i<=100; ++i){ //把数字1~100进行遍历
            if (i%7==0){ //用if筛选能被7整除的数
                sum = sum + i; //用sum接收能被7整数的数并做加法
            }
        }
        System.out.println("1~100能被7整除的数之和为:" + sum);
    }
}
